<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0" />
<title>Insert title here</title>
<link href="../css/common.css" rel="stylesheet" type="text/css"/>
<link href="../css/photo.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="page_ctn">
	<div id="content_ctn">
		<div id="album_list_ctn">
			<ul class="clearfix">
			</ul>
		</div>
		<div id="pagination_ctn"></div>
	</div>
</div>
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/YY_dialog.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript"><!--
$(window).scroll(set_window).resize(set_window);
$.get('ajax_response.php',{type:'login'},function(data){
	if (data.result){
		logined=true;
	}
	load_func();
},'json');
var load_func=function(){
//	var loading=new show_loading();
//	loading.stop();
	set_window();
	if (!logined)
		login();
	else{
		$('#login_ctn').hide();
		$.get('ajax_response.php',{type:'get_album'},function(data){
			var str='';
			var img=new Array();
			$(data).each(function(n,v){
				var img_url='dl.php?id='+v.link_dir+'&t=s&stime='+Math.random();
				img[n]= document.createElement("img");
				if (img[n].readyState){  //IE  
					img[n].onreadystatechange = function(){  
			            if (img[n].readyState == "loaded"||img[n].readyState == "complete"){  
			                img[n].onreadystatechange = null;  
			                callback(img[n],n);  
			            }
			        };
			    } else {  //Others
			        img[n].onload = function(){
			            callback(img[n],n);
			        };
			    }
				img[n].src = img_url;
				str+='<li class="loading"><a href="photo.html?album_id='+v.id+'"><img src="'+img_url+'"/><h4>'+v.catalog_name+'</h4></a></li>';
			});
			$('#content_ctn').show();
			$('#album_list_ctn ul').html(str);
			var photo_obj=$('#album_list_ctn li');
			var show_pic=new water_fall(photo_obj);
			$('#pagination_ctn a').live('click',function(){
				var obj=$(this);
				if (obj.hasClass('c'))
					return false;
				else{
					$('#pagination_ctn a').removeClass('c');
					obj.addClass('c');
				}
				var p=$('#pagination_ctn a').index(obj)+1;
				show_pic.flip_page(p);
			});
			$(window).scroll(show_pic.init).resize(function(){show_pic.init();set_window();});
		},'json');
	}
	//
};
/*
var load=new show_loading();
var img = new Image();
$(img).load(function(){
	load.stop();
	$('#login_bg').hide().css('background','url("dl.php?id=2") center no-repeat').fadeIn();
}).attr("src", 'dl.php?id=2');
*/
--></script>

</body>
</html>